<?php 
require_once '../include.php';

header('content-type:text/html;charset=utf-8');

@$page=$_REQUEST['page']?(int)$_REQUEST['page']:1;
$pageSize=10;
$rows=getMessByPage($page,$pageSize);

// if(!$rows){
//     alertMes("sorry,没有留言信息!","");
//     // exit;
// }

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="styles/backstage.css">
</head>
<body>
<div class="details">
                    
                    <!--表格-->
                    <table class="table" cellspacing="0" cellpadding="0">
                        <thead>
                            <tr>
                                <th width="15%">编号</th>
                                <th width="25%">标题</th>
                                <th width="25%">内容</th>
                                <th width="25%">提交时间</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                        <?php  foreach($rows as $row):?>
                            <tr>
                                <!--这里的id和for里面的c1 需要循环出来-->
                                <td><label for="c1" class="label"><?php echo $row['id'];?></label></td>
                                <td><?php echo $row['title'];?></td>
                                <td><?php echo $row['content'];?></td>
                                <td><?php echo $row['cTime'];?></td>
                                <td align="center"><input type="button" value="删除" class="btn"  onclick="delMess(<?php echo $row['id'];?>)"></td>
                            </tr>
                            <?php endforeach;?>
                            <?php if($totalRows>$pageSize):?>
                            <tr>
                            	<td colspan="4"><?php echo showPage($page, $totalPage);?></td>
                            </tr>
                            <?php endif;?>
                        </tbody>
                    </table>
                </div>
<script type="text/javascript">
	function editMess(id){
		window.location="editMess.php?id="+id;
	}
	function delMess(id){
		if(window.confirm("您确定要删除吗？")){
			window.location="doAdminAction.php?act=delMess&id="+id;
		}
	}
</script>
</body>
</html>
